import selenium
import selenium.webdriver
import time

def login(username,password):
    driver=selenium.webdriver.Firefox()
    driver.get('https://juejin.im/')

    login=driver.find_element_by_class_name('login')
    login.click()  #模拟用户行为点击登陆
    time.sleep(1)

    #抓取用户名  密码文本框输入内容
    user_text=driver.find_element_by_name('loginPhoneOrEmail')
    mima=driver.find_element_by_name('loginPassword')
    time.sleep(1)
    user_text.send_keys(username)
    mima.send_keys(password)
    time.sleep(1)

    loginbtn=driver.find_element_by_xpath('//div/button[@class="btn"]')
    loginbtn.click()


login('xxxxxxxxx','xxxxxxxxx')



